<template>
	<view class="bg fcc maxIndex por" :class="classtr?'headfix':''" :style="headstyle">
		<view class="backbox" v-if="showback"  @click="back">
			<image :src="imgurl" class="pageback"></image>
		</view>
		<view class="header flex-1"  v-if="txt">
			<view :style="styleStr" class="titleTxt">{{txt}}</view>
		</view>
		<view class="rightbox" v-if="iconUrl">
			<image :src="iconUrl" class="rightIcon"  @click="gopage"></image>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			txt: {
				type: String
			},
			showback: {
				type: Boolean,
				default: false
			},
			headstyle:{
				type: String
			},
			classtr:{
				type: Boolean,
				default: false
			},
			url: {
				type: String
			},
			pageurl: {
				type: String
			},
			backing: {
				type: Boolean
			},
			styleStr: {
				type: String
			},
			imgurl: {
				default: require('../static/icon/bark.png')
			},
			iconUrl: {
				type: String
			}
		},
		methods: {
			back() {
				if (this.url) {
					uni.reLaunch({url:this.url})
					
				} 
				else if (this.backing) {
					uni.navigateBack({
						delta: 2
					});
				} 
				else {
					uni.navigateBack({
						delta: 1
					});
				}
				// else if(!this.backing){
				// uni.switchTab({
				// 	url:"../pages/my/my"
				// })
				// }
			},
			gopage() {
				if (this.pageurl) {
					this.navigatePage(this.pageurl, 'slide-in-right')
				}
			}
		},
	}
</script>

<style scoped lang='less'>
	.headfix{
		position: fixed;
		width: 100%;
		top:0;
		left:0;
	}
	.bg{
		background-color: transparent;
		
	}
	.pb15{
		padding-bottom: 30rpx;
	}
	.pt55{
		padding-top: 110rpx;
	}
	.fsb{
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.fcc{
		display: flex;
		align-items: center;
	}
	.pl10 {
		padding-left: 20rpx !important;
	}
	.flex-1{
		flex:1
	}
	.pageback {
		width: 48rpx;
		height:48rpx;
		margin-left: 40rpx;
		margin-top: 48rpx;
		position: relative;
		z-index: 999;
	}

	.header {
		height: 100rpx;
		padding-top: 44rpx;
		line-height:100rpx;
		position: relative;
		text-align: center;
		.titleTxt {
			font-size:34rpx;
			color:#fff;
			letter-spacing: 1rpx;
			height: 100%;
			margin-left: -60rpx;
		}

		.rightIcon {
			width: 48rpx;
			height: 48rpx;
			margin-right: 20rpx;
		}
	}
	/*  */
	/* #ifdef APP-PLUS */
	 .header{
	  padding-top: 44rpx;
	  
	 }
	 .pageback {
	  margin-top: 52rpx;
	 }
	 /* #endif */
</style>
